{% extends "base.html" %}

<body>
{% block header %}
{% include "alert-menu.html" %}
{% endblock %}

{% block content %}
<div class="wrap">
	{% include "tree.html" %}
	<div class="wrap_left right">
		<div class="shenqing1">
		    <h5 style="float:left;width:96%;margin-bottom:10px;">报警中心</h5>
		    <form action="/alert/search/" method="post">
		        <input type="text" name="key" class="word_in"/>
		   	    <input type="submit" value="搜索" class="btn_search"/>
			</form>
		</div>
		<div class="biaoge">
		<table width="100%"  border="0" cellpadding="0" cellspacing="0" class="table2">
	        <tr>
		        <th width="15%">最后报警时间</th>
		        <th width="20%">主机</th>
		        <th width="10%">监控项</th>
		        <th width="10%">当前状态</th>
		        <th width="15%">持续时间</th>
		        <th width="10%">报警次数</th>
		        <th width="10%">原因</th>
		        <th width="10%">处理人</th>
	        </tr>
			{% for a in alert %}
				<tr class="{% cycle 'g1' 'g2' %}">
					<td class="td_left">
					<span class="first style1">{{ a.timestamp|date:"Y-m-d H:i:s" }}</span>
					</td>
					<td><a href="/host/detail?id={{ a.mid.hid.id }}">{{ a.mid.hid.ip}}</a></td>
					<td>{{ a.mid.tpl}}</td>
					<td class="td_mid">
					{% if a.mid.status == "F" %}
					<img src="/static/img/hr.gif" width="16" height="16" alt="" />
					{% else %}
					<img src="/static/img/ys.png" width="16" height="16" alt="" />
					{% endif %}
					</td>
					{% if a.downtime > 300 %} 
					<td><span style="width:10%;text-align:center;color:red">{{ a.downtime }}s</span></td>
					{% else %}
					<td><span style="width:10%;text-align:center">{{ a.downtime }}s</span></td>
					{% endif %}
					<td>5</td>
					{% if merge == 'on' %}
						{% if a.num < 5 %}
						<td><span style="width:10%">{{ a.num }}</span></td>
						{% else %}
						<td><span style="width:10%"><font color='red'>{{ a.num }}</font></span></td>
						{% endif %}
					{% endif %}
					<td>
						<span style="width:7%">
							{% if a.rtype %}
							<a href='/alert/reason?id={{ a.id }}'><font color='green'>{{a.rtype}}</font></a>
							{% else %}
							<a href='/alert/replay?id={{ a.id }}'>回复</a>
							{% endif %}
						</span>
					</td>
					<td><span style="width:8%"> 
						{% if a.rtype %}
							{{a.uid}}
						{% else %}
						待处理
						{% endif %}
					</span></td>
<!--					<span style="width:8%">{{a.uid}}</span>
-->				</tr>
			{% endfor %}
		</table>
	    <div class="page_w">
	    <div class="page_font">总共{{count}}条记录</div>
			<div class="page_r">
			    <ul>
				    <li>
					    <select class="frist" onchange="javascript:window.location.href=this.options[this.selectedIndex].value;">
					    {% for p in page_list %}
					    	<option value="/alert?page={{p}}">第{{p}}页</option>
					    {% endfor %}
					    </select>
				    </li>
				    <li>每页{{num}}条,共{{page_num}}页</li>  
				    <li><a href="/alert?page={{page_num}}" class="page_btn" onMouseDown="this.className='page_btn_d'"><span><ins>末页</ins><img src="/static/img/new/page_ico4.gif" /></span></a></li>
				    <li><a href="/alert?page={{page_down}}" class="page_btn" onMouseDown="this.className='page_btn_d'"><span><ins>下一页</ins><img src="/static/img/new/page_ico3.gif"/></span></a></li>
				    <li><a href="/alert?page={{page_up}}" class="page_btn" onMouseDown="this.className='page_btn_d'"><span><img src="/static/img/new/page_ico2.gif"/><ins>上一页</ins></span></a></li>
				    <li><a href="/alert" class="page_btn" onMouseDown="this.className='page_btn_d'"><span><img src="/static/img/new/page_ico1.gif"/><ins>首页</ins></span></a></li>
			    </ul>
			</div>
		</div>
	</div>
</div>
{% endblock %}

</body>
</html>
